10. processing and sorting machine modular approach 7
因此,我们最终成功地为所有工作站提供了一台完全可以并行工作的机器,它可以完美地并行工作,并且可以有效地运行所有可以并行完成的任务,并且它们可以正确执行。
So we finally managed to get a completely working machine for all the stations that works flawlessly in parallel and it runs efficiently all the tasks that can be done in parallel, they are carried out correctly.
现在,还有一些问题我现在就给大家展示一下,这是因为我们只是把接力棒传到车站,没有用任何逻辑来管理。
Right now, there are still some issues that I will show you right now, and they are due to the fact that we are just passing the baton into the stations and we are not using any logic to manage.
实际的实际站,所以。
The actual the actual stations, so.
我现在将向您展示问题是什么。
I will show you now what a problem is.
所以。
So.
这里的主要问题是机器的状态不同步,这意味着我实际上可以用这个巴顿强制状态。
The main issue here is that the states of the machines are not synchronized, meaning that I can actually force the states with this Bartons.
这意味着如果我按下停止键。
This means that if I press stop.
所有最旧的站仅在获得巡视时才进入停止状态,而不是运行状态,它们能够接受新的启动命令。
All the oldest stations get to a stopping state only when they get the tour, not running states, they are able to accept a new start command.
如果我开始的话。
If I give a start.
来吧,当只有少数站点能够接受时,将会发生的情况是,只有一些站点会启动,而其他站点将陷入另一种运行状态。
Come, and when only a few stations are able to accept that what will happen is that only some stations will start while others will be stuck in a another running state.
所以为了证明美观,电梯运行时我会很快地按下、停止和启动。
So to prove beauteous, I will press, stop and start very quickly when the elevator is moving.
抱歉,我在错误的时刻做的。
Sorry, I did it on the wrong moment.
我也可以为小便做这件事。
I can do it also for the pissin.
因此,如果我现在执行并启动,我会按下、停止并启动所有其他机器或正在运行的机器的其他部分。
So if I do it now and start, I press, stop and start all the other machines or the other parts of the machines are running.
但正如您所看到的,活塞被卡住了,因为他们按下了停止按钮,并且在活塞仍然停止时按下了启动按钮。
But as you can see, the piston is stuck because they pressed stop and they pressed the start when the piston was still stopping.
正如您所看到的,机器的状态正在运行,但销毁站没有运行。
And as you can see, the state of the machines are running, but the destruction station is not running.
因此,要使其再次运行,就必须重新启动。
So to make it run again and it has to start again.
这实际上不太好,因为这意味着对于某些按键组合而言。
And this is actually not so good because it means that for some combination of of keys.
我按了吗,我可以得到我想我可以让我的机器卡住。
Did I press, I can get I guess I can get my machine stuck.
那么,最好还是像以前的状态机一样来管理这里。
So what would be good to go as actually ever state machine here to manage the.
车站,即管理车站的某种分层策略。
Stations, so some kind of hierarchical policy that manages the stations.
所以我现在能做的,我的主要程序是创建一个状态。
So what I can do now, my main program is create a state.
作为整数,作为无符号整数,我将删除。
As an integer, as an unsigned integer, and I will remove.
所有按钮均来自电台的输入。
All the buttons from the inputs of the station's.
所以在甜蜜中,我会的。
So in the sweet, I will.
我们用于管理站机器的情况状态在这里抱歉,假设我们的状态零是机器未运行时。
Our case state for the management of the machines of the station sorry here, let's say that our state zero is when the machine is not running.
这意味着为了成为状态零,所有站点的航空站状态必须等于不运行。
This means that in order to be a state zero, all the stations must have air station state equal to not running.
所以为了。
So in order to.
向机器发出启动命令。
Give a start command to the machines.
那么,我需要的是启动按钮,而不是停止按钮,不是整个按钮,也不是紧急按钮。
What I need to have is the start button and not the stop button and not the whole button and not the emergency button, then.
这是正确的。
That's right.
如果你是的话我就可以搬到另一个州 60 次。
And if you're then I can move to another state that's 60 times.
其中。
In which.
我需要为所有机器赋予启动按钮同等的真实性。
I need to give the start button equal truth to all the machines.
所以我要写的是钻探。
So what I will write is drilling.
从第一个提取站开始,我们应该称之为真相吗?
Start from the first one extraction station that start, should we call the truth?
然后我将留下开始等于真实的破坏。
Then I will leave the devastation that start to be equal to true.
呃,电梯站。
The, uh, elevator station.
哦,抱歉,不是状态,而是开始,让我们开始吧。
Oh, sorry, not state, but the start, let's start we could the.
破坏和苦难从来没有做到这一点,那么我需要钻探站,让我们从真相开始,那就是桌面站,而不是开始成为真相。
The devastation and suffering never already done that, then I need the drilling station, let's start with the truth and that's the table station, not start to be the truth.
好的。
OK.
然后是10。
Then is the 10.
我能做的是,如果该州有天气,我需要等待所有车站运行。
What I can do it is and if I if there is weather in the state, I need to wait for all the stations to be running.
因此,请等待所有站点运行。
So wait for all stations to be running.
所以你我能做的就是说如果提取过程到提取站那站走。
So you're what I can do is that say that if the extraction process to the extraction station that stations take.
等于在不运行的状态下,其他都在运行。
Is equal to in the state not running and all the others are running.
所以我就去一行复制粘贴五次,然后一一替换车站名称。
So I will just go to a line and copy and paste this five times and replace one by one the name of the station.
拉维特电梯脱轨并表。
LaVert elevator derailing and table.
如果他们都在跑步的话。
If they are all running.
然后我将到达一个新状态 20,其中所有站点都在运行。
Then I will get to a new state, 20, where all the stations are running.
所以这里我们的机器完全可以运行。
So here we have machine completely operational running.
抱歉,在这里,我错过了邓。
Sorry, here, I missed the dun.
在这里,当我们转移到另一个状态时,我们不要在这里写“抱歉”,因为所有开始按钮都已经处理完毕,我实际上可以将它们全部设置为 false。
And over here, let's not write a let's sorry here when we moved to another state, since all the start buttons have been already processed, I can actually set them all to false.
对不起,假的。
Sorry, false.
为了完整,我如果。
And in order to be complete, I if.
我是,我们处于状态零,并且尚未按下开始按钮。
I am we are in state zero and the start button has not already been pressed.
我能做的很简单。
What I can do is simply.
将开始也设置为站的开始输入,以强制在此处进行。
Set the start also set to the start input for the stations to force here as well.
好的,现在,如果我们开始进入运行模式,我们需要管理保持按钮、紧急按钮和停止按钮发生的情况。
OK, so right now, if we start we get into a running mode, we need to manage what happens for the hold button, for the emergency button and for the stop button.
所以我们在这里能做的就是拥有与我们内部相同的号码,并拥有一个旧的状态,对不起,整个状态。
So what we can do here is have the same number that we had inside and have an old state sorry, whole state.
并且也有处于停止状态的,一千。
And also have in a stopped state, one thousand.
但我们首先从这里的紧急情况开始,我并没有担心。
But let's first start from the emergency story here, I didn't worry off.
从这里的紧急情况来看,我可以说如果按下紧急按钮。
From the emergency here, I can say that if the emergency button is pressed down.
这里我们还能做的还有一件事,其实我们不需要提,抱歉,就是紧急按钮,因为那实际上总是需要根据按钮来动作,也就是说,每当按下紧急按钮时,紧急按钮具有优先权。
Here what we can do also one thing that we actually don't need to mention, sorry, is the emergency button, because that is actually always need to act according to the button, meaning that whenever a press emergency, the emergency has the priority.
所以我可以简单地把房间再放在这里抱歉,五个呼叫站中的紧急按钮以这种方式,紧急按钮将始终由机器处理。
So I can simply right the room put again here sorry, the emergency button in the five calls the stations in this way, the emergency buttons will always be processed by the machine.
我总是需要说的是,如果紧急按钮被按下,那么状态将变得等于零。
Both What I need always to say is that if the emergency button is pressed, then the state shall become equal to zero.
我们处于哪个州并不重要。
It doesn't matter in which state we are.
好的。
OK.
然后继续前进。
Then moving on.
我们需要管理发生的事情。
In we need to manage what happens.
并且停止按钮被按下。
And the stop button is pressed.
这实际上是我们需要管理的关键事情。
That is actually the critical thing that we need to manage here.
所以。
So.
如果按下停止按钮,我们需要到达状态 1000。
We need to if the stop button is pressed, we need to get to state 1000.
我们需要向所有机器、所有站提供停止输入,所以我们可以正确的是,如果按下停止按钮,那么我们的状态将变为等于 1000,然后所有停止按钮停止输入应该变为真。
And we need to give the stop input to all the machines, to all the stations, so what we can right is that if the stop button is pressed, then we have a state that shall become equal to one thousand and then all the stop button stop input should become true.
因此,让我们将其复制到此处并粘贴到此处。
So let's copy this here and paste this right right here.
让我们从停止开始改变。
And let's change start with stop.
停下来,停下来,停下来。
Stop, stop and stop.
据称,当我们达到一千状态时,通常情况下所有电台都应该进入停止状态。
When we get to state one thousand, allegedly, all the normally all the station should get to the stopping state.
这意味着它们的状态等于 1000。
Which means they are state equal to one thousand here.
然后他们将在那里等待,他们将尝试停下来。
Then they shall wait there, they shall try to stop and.
实际上,呃,达到状态零,这意味着当它们停止时不运行。
Actually, uh, get to state zero, and that means not running when they are stopped.
所以我们的主程序这里是停止状态。
So here in our main program is the stop state.
我们需要等待所有机器、所有站都处于未运行状态。
We need to wait for all the machines, all the stations to be in the not running state.
所以我们可以简单地复制语句和其他而不是运行之前的语句。
So we can simply copy the statement and other not the before the running.
如果我们得到并且没有运行所有的站,那就对了,如果我们可以直接得到状态等于零并且等于零,我们还可以重置状态按钮,这样我们就可以简单地再次复制这个和这个和。
If we get and not running for all the stations, that's right, and if we can directly get the state equal to zero and is equal to zero, we can also reset the state buttons so we can simply, again, copy this and this and.
正确的。
Right.
所以也停下来吧。
So stop as well.
等于力。
Equal to force.
我认为我们不需要管理的是,如果状态不为零并且状态不为 1000,那么这种转变应该发生,就像我们在这里所做的那样。
I don't think that we need to manage is that this transition should happen if the state is not zero and if the state is not one thousand as well in the same way that we did here.
在车站代码中。
In the station code.
好的,那么接下来,我们还需要管理我在这里发表的一些评论,即应急管理。
OK, so moving on, we also need to manage the hold that I had some comments here, emergency management.
停止管理和。
Stop management and.
在这里,等一下。
Here, hold.
这里的管理层,我们遇到了与以前类似的问题。
Management here, we have a similar issue to what we had before.
因为如果我们通过机器,我们就需要我们,所以我们实际上应该确保所有车站都已经停止。
Since we need we if we pass in the machine, we shall be shall actually be sure that all the stations have been stopped.
只有当它们全部停止时,我们才能立即恢复它们。
And only when they are all stopped, we can resume them all at once.
所以在这里,如果我们实际上并不需要并持有。
So here, if we we do not actually need and hold.
管理,因为对所有的和所有的请求进行管理,因为现在对于我们来说,我们不必持有状态机。
Management, because on all the and all the request management, because for now for us here, we do not have to hold the state machine.
我们只需要将整个输入传播到,呃,车站。
We just need to propagate the whole input into the, uh, the stations.
所以让我们看看,如果我们按下旧按钮,并且状态不是零,状态不是一千,状态不是,嗯,五百。
So let's see here that if we have the old button is being pressed and the state is not zero and the state is not one thousand and the state is not, um, five hundred.
然后。
Then.
我们需要将其提供给全世界,并将其平等地传递给所有机器、所有车站。
We need to give this to the whole world and put equal to through to all the machines, to all the stations.
因此,让我们尝试保留此副本并将其粘贴并写入“hold”。
So let's try to hold this copy and paste this and write hold instead of.
但。
But.
我们将移动到等于 500 的状态。
And we shall move to state equal to 500.
在等于 500 的状态下,我们需要等到所有机器都持有。
In a state equal to 500, we need to wait until all the machines are holding.
然后去掉这个洞,只有当hold按钮不等于true时。
And then remove the hole, the only if the hold button is not equal to true.
所以在这里。
So here.
这是正确的。
That's right.
如果。
If.
让我们复制这个。
Let's copy this instead.
如果所有状态都成立,那么让我们将其复制并粘贴到此处。
If all the states are holding, so let's copy and paste it over here.
对了,然后是这个。
Right, and then this.
如果所有的电台都按住并且我们不再有旧的按钮,而不是旧的按钮,那么我们需要做的实际上是变焦。
If all the stations are holding and we no longer have the old button, not old button, then what we need to do is actually over a zoom.
程序,所以所有的评论都会变成假的。
The the program, so all the whole the comment shall become false.
所以让我们复制这个,然后我们会写一些。
So let's copy this and we will write for some.
然后我们实际上应该等待,呃,嗯,所有的机器,整个机器进入运行状态。
And then we should actually wait for, uh, um, all the machines, the complete machine to get into the running state.
这样我们实际上就可以回到斯塔顿了。
So we can actually get back to Stayton.
State 应等于 10。
State should become equal to 10.
好的,我认为我们应该很好地配合这个管理层。
OK, I think we should be good to go with this management.
我们可以尝试下载看看是否有效。
We can try and download and see if it works.
我会。
I will.
当我玩以色列化时,请继续关注这个,所以。
Keep looking at this while I play with the Israeli zation, so.
如果我按开始,抱歉,我需要关闭它并打开它。
If I press start, I'm sorry, I need to close it and open it.
再次。
Again.
如果我按下开始,所有的站都在运行,你可以看到开始是错误的,因为。
If I press the start, all the stations are running, you can see that the start is false because.
一切都在处理中,机器正在完美运行。
Everything is being processed and the machine is running flawlessly.
如果我们进入该程序,我们将处于状态 20,其中机器正在运行,并且我们根本不执行任何操作。
If we get to the program, we are state 20 where the machine is running and we don't do anything at all.
让我们尝试一下关键的。
Let's try the that critical.
组合是正确的术后阿斯塔特。
Combination's is right postop Astarte.
正如您所看到的,机器尚未再次启动,因为它不处于状态零,因此它无法实际接受任何启动按钮和启动请求。
As you can see, the machine hasn't started again because it wasn't in the state zero and it so it wasn't able to do to actually accept any start button and start request.
所以什么也没发生。
So nothing happened.
但现在我可以开始了。
But now I can start.
让我们开始吧。
Let's start it is.
没错,紧急情况下。
That's right, with the emergency.
好吧,我们不跑了。
OK, we are not running.
我们来看看状态。
Let's look at the state.
零在哪里?
Where is the zero?
这很好。
This is good.
我会再次解除紧急状态。
I will remove the emergency again.
和 al-istrabadi 举行,我会等待一些产品到达桌子,所以我们在所有站点都有一些产品。
And al-istrabadi hold, I will wait for some products to reach the table, so we have some products in all the stations.
这是正确的。
That's right.
我会坚持不。
I will hold no.
好的,所有机器都处于暂停状态,让我们取消暂停,所有机器都在运行,我们应该回到状态 20。
OK, all the machines are in holding, let's remove the hold, all the machines are running and we should be back in state 20.
是的,那就是赖兴哈尔。
Yes, that's Reichenhall.
保持。
Holding.
我释放了旧的。
I released the old.
好的,那太好了。
OK, that is great.
一切都运转良好,我们成功地创建了一台功能良好的机器,即模块化结构。
Everything is working great, and we managed to create a quite good functioning machine, the modular structure.
让我们实际上达到了最高效率,在接下来的两个视频中,我们将尝试为这台机器开发一个更加模块化的观点,这意味着我们将尝试在功能块中开发,我们将其称为通用设备可用于管理任何这些设备,从活塞到水平仪到升降机,到夹具,工作台等。
Allowed us to actually reach the top efficiency for this and in the next two videos, we will try to develop an even more modular point of view to this machine, meaning that we will try to develop in function block that we will call generic device that could be used to manage any of these devices from the piston to the level to the elevator, to the gripper, the table and so on.
我们将创建一个功能外观来管理所有这一切,因为现在,如果我们有一个功能齐全的软件,它就会运行得很好。
We will create a function look to manage all of this, because right now, if we have a quite functioning software, it works quite good.
但是,如果由于某种原因我们需要对机器进行一些修改,我们将需要覆盖状态机。
But if for some reason we need we will have some modifications made on the machine, we will need to override the state machines.
在我们的站中,让我们看看是否由于某种原因以及这些机器的下一个实施没有左水平传感器,我们需要重新考虑所有逻辑。
Of our stations, so let's see if for some reason and next implementation of these machines doesn't have the level left sensor, we need to rethink all the logic.
对于没有这种级别传感器的机器,我将向您展示。
For a machine that doesn't have this level of sensor, I will show you.
您将如何在短短几秒钟内管理此更改,因为我们只需要更改一些参数,而您不需要更改状态机中的任何内容,并且您也会对自己有好处。
How you will be able to manage this change in only a few seconds, because we just need to change a few parameters and you will not need to change anything in your state machine and you will be good to your also.
目前,我们不管理电话。
For now, we are not managing the phones.
这里有很多事情可能会出错。
And over here there are many things that could go wrong.
许多传感器,许多执行器。
Many sensors, many actuators.
而且使用这种通用设备,您可以轻松地进行许多折叠检测和功能。
And also with this generic device, many fold detections, features will come to you very easily.
我们将能够毫不费力地实际检测所有这些设备的故障。
We will be able to actually detect faults for all these devices with little to no effort.
因此,我们向您展示的下一组视频将开发此功能。
So the next set of videos that we show you are to develop this.
我们将共同开发这一点,我们将了解为什么我们需要以这种方式实现它,然后我们将尝试在我们的计划中实现这一点。
We will develop this together and we will see why we need to make it in such a way then that we will be we will try to implement this in our program.
所以。
So.
我会在接下来的几年里看到。
I would see in the next years.